﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Drawing;
using System.Text;
using aoprinter.Model;
using aoprinter.Draw;

namespace aoprinter.Core
{
    static class DelimiterOper
    {
        static public void AutoSizeLocation(this ModDelimiter delimiter, SizeF size)
        {
            if (delimiter.AutoSizeWidth)
            {
                if (delimiter.Size.Width < 0)
                {
                    size = new SizeF(-size.Width, size.Height);
                }
                delimiter.Size = new SizeF(size.Width, delimiter.Size.Height);
            }
            if (delimiter.AutoSizeHeight)
            {
                if (delimiter.Size.Height < 0)
                {
                    size = new SizeF(size.Width, -size.Height);
                }
                delimiter.Size = new SizeF(delimiter.Size.Width, size.Height);
            }
        }

        static public void Print(this  ModDelimiter delimiter, Drawer drawer, PointF location)
        {
            drawer.DrawLine(new PointF(location.X + delimiter.Location.X, location.Y + delimiter.Location.Y),
                PointF.Add(delimiter.Location, delimiter.Size), delimiter.LineStyle);
        }
    }
}
